package com.esfak47.mediafetcher.core.event;

import java.io.Serializable;

/**
 * @author tony
 * @date 2018/5/3
 */
public class Event implements Serializable {

    private final EventGroupEnum group;
    private final String subject;
    private final Serializable content;

    public Event(EventGroupEnum eventGroupEnum, String subject, Serializable content) {
        this.group = eventGroupEnum;
        this.subject = subject;
        this.content = content;
    }
    public Event(EventGroupEnum eventGroupEnum, Enum subject, Serializable content) {
        this.group = eventGroupEnum;
        this.subject = subject.name();
        this.content = content;
    }
    public Serializable getContent() {
        return content;
    }

    public String getSubject() {
        return subject;
    }

    public EventGroupEnum getGroup() {
        return group;
    }

    @Override
    public String toString() {
        final StringBuffer sb = new StringBuffer("Event{");
        sb.append("group=").append(group);
        sb.append(", subject='").append(subject).append('\'');
        sb.append(", content=").append(content);
        sb.append('}');
        return sb.toString();
    }
}
